package com.easyCode.realExampleTwo;

import com.easyCode.dataMock.anno.FieldMock;
import com.easyCode.dataMock.anno.TableMock;
import com.easyCode.dataMock.constants.MockRuleConstants;
import com.easyCode.dataMock.constants.RandomRuleConstants;
import com.easyCode.sqlBuilder.constants.DefaultValConstants;
import com.easyCode.sqlBuilder.constants.KeyTypeConstants;
import com.easyCode.sqlBuilder.oop.Filed;
import com.easyCode.sqlBuilder.oop.Key;
import com.easyCode.sqlBuilder.oop.Table;

import java.time.LocalDateTime;

/**
 * @author 大忽悠
 * @create 2023/1/27 19:05
 */
@TableMock
@Table(comment = "事务型消息表")
public class TransactionMessage {
    @Filed(autoIncrement = true,comment = "主键")
    @Key(keyType = KeyTypeConstants.PRIMARY_KEY)
    private Long id;
    @Filed(filedLen = "32",comment = "消息类型")
    @FieldMock(rule = MockRuleConstants.DICT,extra = "C:\\Users\\zdh\\IdeaProjects\\Easy-generator\\src\\test\\java\\com\\easyCode\\realExampleTwo\\messageType.dict")
    private String messageType;
    @Filed(notNull = false,filedLen = "64",comment = "关联业务信息,如: 用户ID")
    @FieldMock(rule = MockRuleConstants.RANDOM,extra = {RandomRuleConstants.INT,"1","100"})
    private String businessKey1;
    @Filed(notNull = false,filedLen = "128",comment = "关联业务信息,如: 订单信息")
    private String businessKey2;
    @Filed(notNull = false,filedLen = "256",comment = "关联业务信息,如: 更加复杂的信息")
    private String businessKey3;
    @Filed(comment = "重试次数",defaultVal = "0")
    private Integer retryNum;
    @Filed(comment = "处理状态,0:初始,1:成功,2:失败",defaultVal = "0")
    private Byte state;
    @Filed(comment = "各个小阶段的处理状态",defaultVal = "0")
    private Byte stageState;
    @Filed(comment = "失败原因",notNull = false)
    private String returnFailureMsg;
    @Filed(comment = "创建时间",defaultVal = DefaultValConstants.CURRENT_TIMESTAMP)
    private LocalDateTime createTime;
    @Filed(comment = "最近一次被消费的时间",defaultVal = DefaultValConstants.CURRENT_TIMESTAMP)
    private LocalDateTime latestExecuteTime;
}
